<template>
  <div id="userSet">
    <k-header headTitle="设置" goBack="true"></k-header>
    <div class="user_set_list" :class="headIos?'side-fixd-ios':'side-fixed'">
      <group>
        <!-- <cell title="联系我们" is-link class="user_balance_title">
          <span slot="default" class="user_price" ></span>
        </cell> -->
          <cell title="关于我们" is-link link="userAbout" class="user_balance_title">
            <span slot="default" ></span>
          </cell>
        <!-- <cell title="清除缓存" is-link class="user_balance_title">
          <span slot="default"><span>200MB</span></span>
        </cell> -->
        <cell title="用户协议" is-link link="agree" class="user_balance_title">
          <span slot="default"></span>
        </cell>
        <!-- <cell title="App Store评分" is-link class="user_balance_title">
          <span slot="default"></span>
        </cell> -->
      </group>
    </div>
    <div class="user_set_state">
      <button class="user_state_btn" @click="legThick">退出登陆</button>
    </div>
    <toast v-model="showPositionValue" type="text" width="100%" :time="1800" is-show-mask :text="message" position="bottom"></toast>
  </div>
</template>

<script>
  import kHeader from '../common/head'
  import { Cell, Group, Alert, Confirm, XDialog, Toast } from 'vux'
  import util from '../../libs/util'
  export default {
    name: 'userAbout',
    data () {
      return {
        showPositionValue: false,
        message: '服务繁忙请重试',
        headIos: false
      }
    },
    components: {
      kHeader,
      Cell,
      Group,
      Alert,
      Confirm,
      XDialog,
      Toast
    },
    created() {
      if (window.navigator.userAgent.indexOf('LBLSIOS') > -1) {
        this.headIos = true;
      }
    },
    methods: {
      legThick() {
        var that = this;
        let url = 'lblsapp-h5/v2/account/loginOut.json';
        util.ajax.post(url).then(function(stats){
          if(stats.data.code == '0' || stats.data.code == '11'){
            that.$cookie.set('mobole', '');
            that.$cookie.set('companystate', '');
            that.$cookie.set('indstate', '');
            that.$cookie.set('token', '');
            that.$router.push('/worker');
          }else if(stats.data.code == '500'){
            that.showPositionValue = true;
          }
        }).catch(function(error){
          console.log(error);
        });
      }
    }
  }
</script>

<style scoped>
  .user_set_list{
    position: absolute;
    width: 100%;
    top:40px
  }
  .side-fixd-ios {
    margin-top: 20px;
  }
  .weui-cell{
    padding: 15px !important;
  }
  .user_set_state{
    position: fixed;
    width: 100%;
    /* top: 322px; */
    left: 0;
    bottom: 0;
  }
  .user_state_btn{
    width: 100%;
    height: 44px;
    border: none;
    background: #fff;
    color: #f99b29;
    font-size: 1.4rem;
  }
 #userSet .vux-label{
    color:#212121;
  }

</style>
